package com.bibrApp.difu.fragment.cloudwallet_mvp;

import android.content.Intent;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.bibrApp.difu.R;
import com.bibrApp.difu.actvity.others.HelpActivity;
import com.bibrApp.difu.actvity.tibi_mvp.TibiActivity;
import com.bibrApp.difu.actvity.wallet_mvp.WalletActivity;
import com.bibrApp.difu.base.BaseFragment;
import com.bibrApp.difu.fragment.wallet_mvp.IWalletView;
import com.bibrApp.difu.fragment.wallet_mvp.WalletPresenter;

import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

public class CloudWalletFragment extends BaseFragment<CloudWalletPresenter> implements ICloudWalletView {


    @BindView(R.id.recycler_view)
    RecyclerView recyclerView;
    private CloudWalletAdapter adapter;

    @Override
    protected int getLayoutResId() {
        return R.layout.fragment_list;
    }

    @Override
    protected void initPresenter() {
        presenter = new CloudWalletPresenter(getContext(), this);
        presenter.init();
    }

    @Override
    public void error(String msg) {

    }

    @Override
    public void onDataResult(List<CloudWalletBean> datas) {
        adapter.setNewData(datas);
    }

    @Override
    public void initView() {

        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

        adapter = new CloudWalletAdapter();
        recyclerView.setAdapter(adapter);
        adapter.setOnItemChildClickListener((adapter1, view, position) -> {
            if (view.getId() == R.id.tv_tibi) {
                startActivity(new Intent(getContext(), TibiActivity.class));
            }
        });

        presenter.getDatas();
    }


}
